<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="模具编号" prop="moldNumber">
        <el-input
          v-model="queryParams.moldNumber"
          placeholder="请输入模具编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="产品名称" prop="productName">
        <el-input
          v-model="queryParams.productName"
          placeholder="请输入产品名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="客户简称" prop="customerNickName">
        <el-input
          v-model="queryParams.customerNickName"
          placeholder="请输入客户简称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="材质" prop="material">
        <el-input
          v-model="queryParams.material"
          placeholder="请输入材质"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="料宽步距料厚" prop="widthStepThickness">
        <el-input
          v-model="queryParams.widthStepThickness"
          placeholder="请输入料宽步距料厚"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="产品外形尺寸" prop="productDimensions">
        <el-input
          v-model="queryParams.productDimensions"
          placeholder="请输入产品外形尺寸 (长 x宽x高, mm ) "
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料号/图号" prop="drawingNumber">
        <el-input
          v-model="queryParams.drawingNumber"
          placeholder="请输入物料号 -图号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="工程师" prop="engineer">-->
<!--        <el-input-->
<!--          v-model="queryParams.engineer"-->
<!--          placeholder="请输入工程师"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="客户编号" prop="customerNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.customerNo"-->
<!--          placeholder="请输入客户编号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="客户名称" prop="customerName">-->
<!--        <el-input-->
<!--          v-model="queryParams.customerName"-->
<!--          placeholder="请输入客户名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="产品编码" prop="productCode">-->
<!--        <el-input-->
<!--          v-model="queryParams.productCode"-->
<!--          placeholder="请输入产品编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="标准产能 ( pcs / h ) " prop="standardCapacity">-->
<!--        <el-input-->
<!--          v-model="queryParams.standardCapacity"-->
<!--          placeholder="请输入标准产能 ( pcs / h ) "-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="电镀" prop="plating">-->
<!--        <el-input-->
<!--          v-model="queryParams.plating"-->
<!--          placeholder="请输入电镀"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="包装方式" prop="packaging">-->
<!--        <el-input-->
<!--          v-model="queryParams.packaging"-->
<!--          placeholder="请输入包装方式"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="吸塑盘规格" prop="vacuumTray">-->
<!--        <el-input-->
<!--          v-model="queryParams.vacuumTray"-->
<!--          placeholder="请输入吸塑盘规格"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="供应商" prop="manufacturer">
        <el-input
          v-model="queryParams.manufacturer"
          placeholder="请输入供应商"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="单价" prop="unitPrice">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitPrice"-->
<!--          placeholder="请输入单价"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="创建者" prop="createBy">-->
<!--        <el-input-->
<!--          v-model="queryParams.createBy"-->
<!--          placeholder="请输入创建者"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="daterangeCreateTime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
<!--      <el-form-item label="更新者" prop="updateBy">-->
<!--        <el-input-->
<!--          v-model="queryParams.updateBy"-->
<!--          placeholder="请输入更新者"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="更新时间">
        <el-date-picker
          v-model="daterangeUpdateTime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['customer:bom:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['customer:bom:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['customer:bom:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
            type="info"
            plain
            icon="el-icon-upload2"
            size="mini"
            @click="handleImport"
            v-hasPermi="['customer:bom:import']"
        >导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['customer:bom:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="bomList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="50" align="center" />
<!--      <el-table-column label="唯一主键ID" align="center" prop="id" />-->
      <el-table-column label="模具编号" align="center" prop="moldNumber" />
      <el-table-column label="产品名称" align="center" prop="productName" />
      <el-table-column label="客户简称" align="center" prop="customerNickName" />
      <el-table-column label="材质" align="center" prop="material" />
      <el-table-column label="料宽步距料厚" align="center" prop="widthStepThickness" />
      <el-table-column label="产品外形尺寸" align="center" prop="productDimensions" />
      <el-table-column label="物料号/图号" align="center" prop="drawingNumber" />
      <el-table-column label="工程师" align="center" prop="engineer" />
<!--      <el-table-column label="客户编号" align="center" prop="customerNo" />-->
<!--      <el-table-column label="客户名称" align="center" prop="customerName" />-->
<!--      <el-table-column label="产品编码" align="center" prop="productCode" />-->
      <el-table-column label="标准产能 ( pcs / h ) " align="center" prop="standardCapacity" />
      <el-table-column label="电镀" align="center" prop="plating" />
<!--      <el-table-column label="模具类型" align="center" prop="moldType" />-->
      <el-table-column label="包装方式" align="center" prop="packaging" />
      <el-table-column label="吸塑盘规格" align="center" prop="vacuumTray" />
      <el-table-column label="供应商" align="center" prop="manufacturer" />
      <el-table-column label="单价" align="center" prop="unitPrice" />
<!--      <el-table-column label="备注" align="center" prop="remark" />-->
<!--      <el-table-column label="删除标志" align="center" prop="delFlag" />-->
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
        <template slot-scope="scope">
          <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleView(scope.row,scope.index)"
              v-hasPermi="['customer:bom:query']"
          >详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['customer:bom:edit']"
          >修改</el-button>





          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['customer:bom:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改CsBomInfo对话框 -->
    <el-dialog :title="title" :visible.sync="updateopen" width="850px" append-to-body>
      <el-form :inline="true" class="demo-form-inline" ref="form" :model="form" :rules="rules" label-width="150px">
        <el-form-item label="模具编号" prop="moldNumber">
          <el-input v-model="form.moldNumber" placeholder="请输入模具编号" />
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入产品名称" />
        </el-form-item>
        <el-form-item label="客户简称" prop="customerNickName">
          <el-input v-model="form.customerNickName" placeholder="请输入客户简称" />
        </el-form-item>
        <el-form-item label="材质" prop="material">
          <el-input v-model="form.material" placeholder="请输入材质" />
        </el-form-item>
        <el-form-item label="料宽步距料厚" prop="widthStepThickness">
          <el-input v-model="form.widthStepThickness" placeholder="请输入料宽步距料厚" />
        </el-form-item>
        <el-form-item label="产品外形尺寸 (长 x宽x高, mm ) " prop="productDimensions">
          <el-input v-model="form.productDimensions" placeholder="请输入产品外形尺寸 (长 x宽x高, mm ) " />
        </el-form-item>
        <el-form-item label="物料号 -图号" prop="drawingNumber">
          <el-input v-model="form.drawingNumber" placeholder="请输入物料号 -图号" />
        </el-form-item>
        <el-form-item label="工程师" prop="engineer">
          <el-input v-model="form.engineer" placeholder="请输入工程师" />
        </el-form-item>
        <el-form-item label="客户编号" prop="customerNo">
          <el-input v-model="form.customerNo" placeholder="请输入客户编号" />
        </el-form-item>
        <el-form-item label="客户名称" prop="customerName">
          <el-input v-model="form.customerName" placeholder="请输入客户名称" />
        </el-form-item>
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form.productCode" placeholder="请输入产品编码" />
        </el-form-item>
        <el-form-item label="标准产能 ( pcs / h ) " prop="standardCapacity">
          <el-input v-model="form.standardCapacity" placeholder="请输入标准产能 ( pcs / h ) " />
        </el-form-item>
        <el-form-item label="电镀" prop="plating">
          <el-input v-model="form.plating" placeholder="请输入电镀" />
        </el-form-item>
        <el-form-item label="包装方式" prop="packaging">
          <el-input v-model="form.packaging" placeholder="请输入包装方式" />
        </el-form-item>
        <el-form-item label="吸塑盘规格" prop="vacuumTray">
          <el-input v-model="form.vacuumTray" placeholder="请输入吸塑盘规格" />
        </el-form-item>
        <el-form-item label="供应商" prop="manufacturer">
          <el-input v-model="form.manufacturer" placeholder="请输入供应商" />
        </el-form-item>
        <el-form-item label="单价" prop="unitPrice">
          <el-input v-model="form.unitPrice" placeholder="请输入单价" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- CsBomInfo详情对话框 -->
    <el-dialog :title="title" :visible.sync="detailopen" width="850px" append-to-body>
      <el-form :inline="true" class="demo-form-inline" ref="form" :model="form" :rules="rules" label-width="150px">
                        <el-form-item label="模具编号" prop="moldNumber">
                          <el-input v-model="form.moldNumber" placeholder="请输入模具编号" />
                        </el-form-item>
                        <el-form-item label="产品名称" prop="productName">
                          <el-input v-model="form.productName" placeholder="请输入产品名称" />
                        </el-form-item>
                        <el-form-item label="客户简称" prop="customerNickName">
                          <el-input v-model="form.customerNickName" placeholder="请输入客户简称" />
                        </el-form-item>
                        <el-form-item label="材质" prop="material">
                          <el-input v-model="form.material" placeholder="请输入材质" />
                        </el-form-item>
                        <el-form-item label="料宽步距料厚" prop="widthStepThickness">
                          <el-input v-model="form.widthStepThickness" placeholder="请输入料宽步距料厚" />
                        </el-form-item>
                        <el-form-item label="产品外形尺寸 (长 x宽x高, mm ) " prop="productDimensions">
                          <el-input v-model="form.productDimensions" placeholder="请输入产品外形尺寸 (长 x宽x高, mm ) " />
                        </el-form-item>
                        <el-form-item label="物料号 -图号" prop="drawingNumber">
                          <el-input v-model="form.drawingNumber" placeholder="请输入物料号 -图号" />
                        </el-form-item>
                        <el-form-item label="工程师" prop="engineer">
                          <el-input v-model="form.engineer" placeholder="请输入工程师" />
                        </el-form-item>
                        <el-form-item label="客户编号" prop="customerNo">
                          <el-input v-model="form.customerNo" placeholder="请输入客户编号" />
                        </el-form-item>
                        <el-form-item label="客户名称" prop="customerName">
                          <el-input v-model="form.customerName" placeholder="请输入客户名称" />
                        </el-form-item>
                        <el-form-item label="产品编码" prop="productCode">
                          <el-input v-model="form.productCode" placeholder="请输入产品编码" />
                        </el-form-item>
                        <el-form-item label="标准产能 ( pcs / h ) " prop="standardCapacity">
                          <el-input v-model="form.standardCapacity" placeholder="请输入标准产能 ( pcs / h ) " />
                        </el-form-item>
                        <el-form-item label="电镀" prop="plating">
                          <el-input v-model="form.plating" placeholder="请输入电镀" />
                        </el-form-item>
                        <el-form-item label="包装方式" prop="packaging">
                          <el-input v-model="form.packaging" placeholder="请输入包装方式" />
                        </el-form-item>
                        <el-form-item label="吸塑盘规格" prop="vacuumTray">
                          <el-input v-model="form.vacuumTray" placeholder="请输入吸塑盘规格" />
                        </el-form-item>
                        <el-form-item label="供应商" prop="manufacturer">
                          <el-input v-model="form.manufacturer" placeholder="请输入供应商" />
                        </el-form-item>
                        <el-form-item label="单价" prop="unitPrice">
                          <el-input v-model="form.unitPrice" placeholder="请输入单价" />
                        </el-form-item>
                        <el-form-item label="备注" prop="remark">
                          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="detailopen = false">关 闭</el-button>
      </div>
    </el-dialog>




    <!-- 导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
          ref="upload"
          :limit="1"
          accept=".xlsx, .xls"
          :headers="upload.headers"
          :action="upload.url + '?updateSupport=' + upload.updateSupport"
          :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress"
          :on-success="handleFileSuccess"
          :auto-upload="false"
          drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>



  </div>
</template>

<script>
import { listBom, getBom, delBom, addBom, updateBom } from "@/api/customer/bom";
import {getToken} from "@/utils/auth";

export default {
  name: "Bom",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // CsBomInfo表格数据
      bomList: [],
      // 弹出层标题
      title: "",
      // 是否详情显示弹出层
      detailopen: false
      ,
      // 是否修改新增显示弹出层
      updateopen: false
      ,
      // 是否显示弹出层
      open: false,
      // 删除标志时间范围
      daterangeCreateTime: [],
      // 删除标志时间范围
      daterangeUpdateTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        moldNumber: null,
        productName: null,
        customerNickName: null,
        material: null,
        widthStepThickness: null,
        productDimensions: null,
        drawingNumber: null,
        engineer: null,
        customerNo: null,
        customerName: null,
        productCode: null,
        standardCapacity: null,
        plating: null,
        packaging: null,
        moldType: null,
        vacuumTray: null,
        manufacturer: null,
        unitPrice: null,
        remark: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      },
      // 表单参数
      form: {},
      // 导入参数
      upload: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题（
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "customer/bom/importData"
      },
      // 表单校验
      rules: {
        moldNumber: [
          { required: true, message: "模具编号不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询CsBomInfo列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
      }
      if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
        this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
        this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
      }
      listBom(this.queryParams).then(response => {
        this.bomList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.updateopen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        moldNumber: null,
        productName: null,
        customerNickName: null,
        material: null,
        widthStepThickness: null,
        productDimensions: null,
        drawingNumber: null,
        engineer: null,
        customerNo: null,
        customerName: null,
        productCode: null,
        standardCapacity: null,
        plating: null,
        packaging: null,
        moldType: null,
        vacuumTray: null,
        manufacturer: null,
        unitPrice: null,
        remark: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreateTime = [];
      this.daterangeUpdateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.updateopen = true;
      this.title = "添加CsBomInfo";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getBom(id).then(response => {
        this.form = response.data;
        this.updateopen = true;
        this.title = "修改CsBomInfo";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateBom(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.updateopen = false;
              this.getList();
            });
          } else {
            addBom(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.updateopen = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除CsBomInfo编号为"' + ids + '"的数据项？').then(function() {
        return delBom(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 详情按钮操作 */
    handleView(row) {
      this.detailopen = true;
      this.form = row;
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('customer/bom/export', {
        ...this.queryParams
      }, `bom_${new Date().getTime()}.xlsx`)
    },
/** 导入按钮操作 */
handleImport() {
  this.upload.title = "导入";
  this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
  this.download('customer/bom/importTemplate', {
  }, `customer_bom_template.xlsx`)
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
  this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
  this.upload.open = false;
  this.upload.isUploading = false;
  this.$refs.upload.clearFiles();
  this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  this.getList();
},
// 提交上传文件
submitFileForm() {
  this.$refs.upload.submit();
}
  }
};
</script>
